// import React, { useRef } from 'react'

// function useDebunse(fn, disty) {

//     const time = useRef()
//     return (...arg) => {
//         clearTimeout(time.current)
//         time.current = setTimeout(() => {
//             fn(...arg)
//         }, disty)
//     }
// }

// export default useDebunse



import React, { useRef } from 'react'

function useDebunse(fn, disty) {        

    const time = useRef()

    return (...arg) => {
        clearTimeout(time.current)
        time.current = setTimeout(() => {
            fn(...arg)
        }, disty)
    }
}

export default useDebunse


// 防抖